#!/bin/ksh

if [[ $# -ne 1 ]] ;
then "Usage: trimSBBX name_of_SBBX_file"
     exit
fi

if [[ ! -s $1 ]] ; then echo "$1 not found" ; exit ; fi

fortran_compile=$FC
if [[ $FC = '' ]]
then echo "set an environment variable FC to the fortran_compile_command like f90"
     echo "or do all compilation first and comment the compilation lines"
     exit
fi

ln $1 fort.10
${fortran_compile} trimSBBX.f -o trimSBBX.exe
trimSBBX.exe
mv fort.11 $1.trim
rm -f fort.10
